package com.core.resp;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.models.auth.In;

import java.util.List;

/**
 * @author : HUANG
 * @create : 2025/6/1 20:43
 * @function :
 */
public class PageResult<T> {
    private Long pageSize;
    private Long pageNum;
    private List<T> data;
    private Long total;

    public PageResult() {
    }

    public PageResult(Page<T> page) {
        this.pageSize = page.getSize();
        this.pageNum = page.getPages();
        this.total = page.getTotal();
        this.data = page.getRecords();
    }

    public PageResult(Long pageSize, Long pageNum, List<T> data, Long total) {
        this.pageSize = pageSize;
        this.pageNum = pageNum;
        this.data = data;
        this.total = total;
    }

    public Long getPageSize() {
        return pageSize;
    }

    public void setPageSize(Long pageSize) {
        this.pageSize = pageSize;
    }

    public Long getPageNum() {
        return pageNum;
    }

    public void setPageNum(Long pageNum) {
        this.pageNum = pageNum;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }
}
